#ifndef _TCPWRAPPER_H
#define _TCPWRAPPER_H


#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
#include <netdb.h>
#include <string>
#include <string.h>
#include <unistd.h>
#include <iostream>
#include <fstream>

using namespace std;

#define SUCCESS 0
#define FAILURE -1
#define LEN 2000 // max message size
#define BACKLOG 10

void init_tcpwrapper(fstream* logfile);

int sendMsg(int fd, string msg);

int recvMsg(int fd, string& msg, int timeout=5);

int connect(int port, string address);

int listen(int port);

int accept(int fd);

#endif
